package com.dartfar.workflow.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.dartfar.base.dao.DaoUtil;
import com.dartfar.base.service.BaseServiceImpl;
import com.dartfar.workflow.model.WorkflowEvents;
import com.dartfar.workflow.model.WorkflowTaskFunMount;

@Component("workflowTaskFunMountService")
public class WorkflowTaskFunMountServiceImpl extends BaseServiceImpl<WorkflowTaskFunMount> implements WorkflowTaskFunMountService{

	
	@Resource
	private DaoUtil<WorkflowTaskFunMount> workflowTaskFunMountDaoUtil;
	
	/**
	 * 根据流程定义ID获取流程事件分页列表
	 * @param id
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	@Override
	public List<WorkflowTaskFunMount> getListForPageByWorkflowProcessId(int id,
			int pageNo, int pageSize) {
		// TODO Auto-generated method stub
		String hql = "from WorkflowTaskFunMount w where w.workflowProcessFunMount.id = " + id;
		return workflowTaskFunMountDaoUtil.getListForPage(hql, (pageNo-1)*pageSize, pageSize);
	}
	
	/**
	 * 根据流程定义ID获取流程事件总数
	 * @param id
	 * @return
	 */
	@Override
	public Long getCountByWorkflowProcessId(int id){
		String hql = "from WorkflowTaskFunMount w where w.workflowProcessFunMount.id = " + id;
		return workflowTaskFunMountDaoUtil.getCount(hql);
	}
}
